<?php

// Acceso restringido
defined('JL') or die('Acceso restringido');

class LesCSMEModel extends JLModelBase {

    /**
     * Funcion que retorna LesCSME
     * @Retorna array
     */
    public function getLesCSMEById($id) {
        $_true = null;

        $sql = "SELECT 
              `int_id_presentation`,
              `txt_le_csme`
            FROM 
              `tbl_presentation`  
            WHERE int_id_presentation = " . $this->DB->Quote($id) . "";

        $this->DB->executeQuery($sql);

        if ($this->DB->getRowsAffected() > 0) {
            $_true = $this->DB->getDataArray();
            $_true = $_true[0];
        }

        return $_true;
    }

    /**
     * actualiza LesCSME
     * @Retorna bool
     */
    public function updateLesCSME($int_id_presentation, $txt_le_csme) {
        $_true = false;

        $sql = "UPDATE 
              `tbl_presentation`  
            SET
              `txt_le_csme` = " . $this->DB->Quote($txt_le_csme) . "
            WHERE 
              `int_id_presentation` = " . $this->DB->Quote($int_id_presentation) . "";

        $this->DB->executeQuery($sql);

        if ($this->DB->getRowsAffected() > 0) {
            $_true = true;
        }

        return $_true;
    }

}